﻿using com.fmtx.IDal;
using fmtx.Framework.DALFactory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace website.Areas.UCenter.Controllers
{
    public class ArticleController : BaseController
    {
        //
        // GET: /UCenter/Article/
        IArticle article = DataAccess<IArticle>.GetObject();
        IArticleType articletype = DataAccess<IArticleType>.GetObject();
        IUserInfo user = DataAccess<IUserInfo>.GetObject();

        /// <summary>
        /// 个人中心
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        public ActionResult Index(int uid)
        {
            List<OutPut> models =new List<OutPut>();
            var list=article.Query(0, 20,0, uid, null, uid == userInfo.Uid);
            ViewBag.types = articletype.Query(uid);
            foreach (var item in list)
            {
                models.Add(ArticleCache.BindDetail(item));
            }
            if (models.Count > 0)
            {
                ViewBag.lastid = models.LastOrDefault().Id;
            }
            return View(models);
        }

    }
}
